package com.xd.signin.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.text.SimpleDateFormat;

@Controller
public class PageController {
    @Autowired
    private RedisTemplate redisTemplate;

    long time=System.currentTimeMillis();
    SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-mm-dd  HH:mm:ss");
    String format = simpleDateFormat.format(time);

    @RequestMapping("/index")
    public String index(){
        return "index";
    }

    @RequestMapping("/sign")
    @ResponseBody
    public String sign(String username){
        redisTemplate.opsForValue().set(username,format);
        String name = (String) redisTemplate.opsForValue().get("name");
        return "aa";
    }
}
